<?php
header("Content-Type: text/html; charset=ISO-8859-1",true);
if(!isset($_SESSION))session_start();
if(!isset($_SESSION['usuario'])){
	session_destroy();
	header("location:index.php"); exit;
	}


include 'classes/crud.php';
$con = new Crud();
$con->connect();
//## setando bd de teste ##
//$con->setDatabase("test");
$query = mysql_query("select * from arvore order by cod_filho");
$query1 = mysql_num_fields($query);
$queryf = mysql_query("select * from arvore");
$queryf1 = mysql_num_fields($queryf);

$i=1;
//$tabs= str_repeat("-", $conta);
/*
 echo "<ul>andre";
 echo "<li>andreluiz</li>";
 echo"</ul>";*/

echo "<ul>";
$tabs=str_repeat("-", $conta);
while ($result = mysql_fetch_array($query)){
	//var_dump($result['pasta']);
	echo "<ul>";

	if ($result['pasta']==1 and ($result['pai']!= 0) and  $result['cod_filho'] == $result['cod_pai'])
		echo "{$tabs}<a href=#><img src=\"css/img/pasta.gif\">{$result['nome']}</a>";
			if (($result['pasta']==0) and ($result['cod_pai'] == $result['cod_filho']))
			echo "<li>{$result['nome']}</li><br/>";
		
	
	echo"</ul>";
	$conta++;
	//var_dump($result);
}
echo"</ul>";





